UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KD5yn/sNw5cJDij9UqIIymzxoM22tsGj8FmLcXRiwvI=' 
WHERE 
  key_id = 'f92522b203f39eb2282b7ad6708a34658ccfc775af165c43b3935e95f403de64' 
  AND (
    token = 'KD5yn/sNw5cJDij9UqIIymzxoM22tsGj8FmLcXRiwvI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050