UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'E5wif5RNCvkZSLAAuVB46GFpuKLES+bKCU50XizpDmM=' 
WHERE 
  key_id = 'e4feb70c33c2d8ebec9de43b14f189192c95f78e35e90eccca2f62012dda9d44' 
  AND (
    token = 'E5wif5RNCvkZSLAAuVB46GFpuKLES+bKCU50XizpDmM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030