UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VyWKHHrTl+hFrRtoaA3Qi/20shd8+vmLvTVmGsdfgHU=' 
WHERE 
  key_id = '723b30890d476ec12d7bff4d64cdbc0495db7e5e6c950f25c47ab98649e16963' 
  AND (
    token = 'VyWKHHrTl+hFrRtoaA3Qi/20shd8+vmLvTVmGsdfgHU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027