UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w0xqXv6pWwCKrHAD5LULoBxEEyVaLCJIBTAiKXVUpH0=' 
WHERE 
  key_id = '48a1dca646ffdcac1a7fbdff6e0a382d82a89c02da5c85f6fe391c7f57b1b3b8' 
  AND (
    token = 'w0xqXv6pWwCKrHAD5LULoBxEEyVaLCJIBTAiKXVUpH0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00060