UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bQ88FoBmrf8amnUvEU1+c9U98Cw0cPvJ0gQ7PYRhBuU=' 
WHERE 
  key_id = '49e78cb9870351be1272b96f4b8f0d18626e77093ad3aed1679946c87d1df340' 
  AND (
    token = 'bQ88FoBmrf8amnUvEU1+c9U98Cw0cPvJ0gQ7PYRhBuU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024