UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'lhFfkTJlu4vWK8GF7V8VqajfNdNE1xFdNr2giETCR7M=' 
WHERE 
  key_id = '505aabc078c366b72e82f1806658dd39060386ecad8b0c0f34625680017de3f7' 
  AND (
    token = 'lhFfkTJlu4vWK8GF7V8VqajfNdNE1xFdNr2giETCR7M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049