UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'q9/2oaZP9eseivZIRmPHd0MQyQRt/SP7ium7oYACewo=' 
WHERE 
  key_id = 'f74b128313e5e723a06e83905cee06d116638d49884d18b271c7ae577962238f' 
  AND (
    token = 'q9/2oaZP9eseivZIRmPHd0MQyQRt/SP7ium7oYACewo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036