UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JvUDI+Doh54pr7q8vo6N8v03nsGrKNknqTfNqHS7AZs=' 
WHERE 
  key_id = 'a1497b7f1ceb305877064923b267e56d1fd60d0dee6767c787c4e4b6a9b39564' 
  AND (
    token = 'JvUDI+Doh54pr7q8vo6N8v03nsGrKNknqTfNqHS7AZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038