UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bb2f4bvqv3BfstRMozem46/6Aa8uRXh2wRgdGH0t024=' 
WHERE 
  key_id = '7432cdbca17069b7559cb5f4e60da14659739843ce55b4bb4df990e66158509c' 
  AND (
    token = 'bb2f4bvqv3BfstRMozem46/6Aa8uRXh2wRgdGH0t024=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025