UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5TQCHEErgGFbNitGTemEy6eio3hxSTKeUl8606kuyY=' 
WHERE 
  key_id = '3ed5db66482cc62d744354d297f3b9c702e234f2b27fe08441723b62d8289720' 
  AND (
    token = 'D5TQCHEErgGFbNitGTemEy6eio3hxSTKeUl8606kuyY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028