UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XmwRPS6Nu/xdGFLfKiMMW1WCblb8mygfeeYzva0Ww4U=' 
WHERE 
  key_id = '393de589493c52ee12ad31ae8a66c23fadf3d14585c34bbf55c094ffdaa94c04' 
  AND (
    token = 'XmwRPS6Nu/xdGFLfKiMMW1WCblb8mygfeeYzva0Ww4U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028