UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'y7cneU1u51pvQMGkc4qyo7+JJbeoAoMMoQtPgITYzeo=' 
WHERE 
  key_id = '8397a00ca6cca7a73daa13cface0b3cc198ae22bc56c96229fcc913991c198e5' 
  AND (
    token = 'y7cneU1u51pvQMGkc4qyo7+JJbeoAoMMoQtPgITYzeo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051