UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ffubLGZ6ROCQYNMb65iboMIlR1YqtspEjrcjuPj3YPU=' 
WHERE 
  key_id = 'd5ec9d136d0faa2edf34c327956ceb3a5a8dc7d9b837c65a1ab1bc538130ec85' 
  AND (
    token = 'ffubLGZ6ROCQYNMb65iboMIlR1YqtspEjrcjuPj3YPU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022