UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tqrJ/MNdVWBv14x3qAaT/+3akgBaojwM3r0tDHb2auA=' 
WHERE 
  key_id = '0e5de992bf671f91f9c480df551dc55fca36aea09bf8d97e719193b2ed26d90b' 
  AND (
    token = 'tqrJ/MNdVWBv14x3qAaT/+3akgBaojwM3r0tDHb2auA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036