UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7mhsM9uS00TBNksy3ShRDOtvd06Hm0IvENvluRMkI1Q=' 
WHERE 
  key_id = '99d3415877419fe059e92549dce376a47719cf04bab34da3f5ca2b0fbb483f5b' 
  AND (
    token = '7mhsM9uS00TBNksy3ShRDOtvd06Hm0IvENvluRMkI1Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032