UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KL4yBj7iar5ZOPq8sXRDrr38zbatpDwC9XQSdAznKPw=' 
WHERE 
  key_id = '2322be1c1a2fdb0d20410538b96bd5f08dd380dc45b71781ebfe9dfddbe4a0db' 
  AND (
    token = 'KL4yBj7iar5ZOPq8sXRDrr38zbatpDwC9XQSdAznKPw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026