UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yFsyF2mca83Ppi5gfpuVa0ddwwKhbDj0sSCBuUx7taI=' 
WHERE 
  key_id = '73e8904034f862d4964b1cdf4ac600769f9a7390e71c781acb2c068698b45f0d' 
  AND (
    token = 'yFsyF2mca83Ppi5gfpuVa0ddwwKhbDj0sSCBuUx7taI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030