UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Iio06aNg1+7uTKncI9XDo5KS2Po3FSFgsgTR5hQwEWQ=' 
WHERE 
  key_id = '707f65e523a1f86c25f247f3210d70f57abee231ccb06a99e2ad5660cdbb4797' 
  AND (
    token = 'Iio06aNg1+7uTKncI9XDo5KS2Po3FSFgsgTR5hQwEWQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045