UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'BdXevassz6O0EIFs9o05wpGFR3m6EyiKaJZ1xdi+vwY=' 
WHERE 
  key_id = 'f4958d9d811b136ea051aeb28515a0415a98a1be3a90a2582eeafa30fdb8f9ec' 
  AND (
    token = 'BdXevassz6O0EIFs9o05wpGFR3m6EyiKaJZ1xdi+vwY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046