UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4t4EvKz3VstW6gey8ioGh5QpPJUo8Hp2irYeprxJxso=' 
WHERE 
  key_id = '2650093e13820171d6eecf5d62ea685e342d2f5f80263721b84259c93bac62e0' 
  AND (
    token = '4t4EvKz3VstW6gey8ioGh5QpPJUo8Hp2irYeprxJxso=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034