UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eG21ey87wGBfxJB88Sogq3QeSsFqhBMkYotvfsXv3KQ=' 
WHERE 
  key_id = '19907be9b3916e610148622603288b565993bf3b198ade5be2a84b2c01792c3c' 
  AND (
    token = 'eG21ey87wGBfxJB88Sogq3QeSsFqhBMkYotvfsXv3KQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032