UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xrC9p/xwNfdwFsD6NIpe3Y9HbniOarQRBGi/HOeU46Y=' 
WHERE 
  key_id = '2e4a414ec2e89d87567d0e5e5541b9ce69dd25d253cba180d9c76fdef257ec95' 
  AND (
    token = 'xrC9p/xwNfdwFsD6NIpe3Y9HbniOarQRBGi/HOeU46Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047