UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TqwKViicdqs354qinqhCxPSua8mszb6kCx5x1v4Mpts=' 
WHERE 
  key_id = '44ee667fcf9a7e2528738f093d9800848f201ee0878191a9be77a3da0e0780e1' 
  AND (
    token = 'TqwKViicdqs354qinqhCxPSua8mszb6kCx5x1v4Mpts=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021