UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sVx8ieEa4gBGYgvrhK2kUCkcR58R509MobTgY3sI+GQ=' 
WHERE 
  key_id = '66830becc2c8982a08fb2926c7431143db9c90750121f17aa83001cb1ca70622' 
  AND (
    token = 'sVx8ieEa4gBGYgvrhK2kUCkcR58R509MobTgY3sI+GQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035