UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XRAESwtg+P9KFNCDTsdXp/3C8tpAMCpVSWUSjELV5jE=' 
WHERE 
  key_id = '45f2bc6db8151facc6d7723a5cb50311b55bdfafcac1276ba44a35252483ca24' 
  AND (
    token = 'XRAESwtg+P9KFNCDTsdXp/3C8tpAMCpVSWUSjELV5jE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042