UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SBgdVG/1qu2OdZyQ9mXowl4fkybr5mTeVD6m6Z/5GDA=' 
WHERE 
  key_id = '2d01e12cf77ce2f3304b501161638c702251a227f22781db2e25ac066beaaddb' 
  AND (
    token = 'SBgdVG/1qu2OdZyQ9mXowl4fkybr5mTeVD6m6Z/5GDA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022