UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pKWiPMMZK0LKeWpJlNV4eYFHNUCbxTgkxA+1H0sYt6U=' 
WHERE 
  key_id = '566c506b7cf87021f59adb35636c2e580a5d67196e307a2c0f87e2ca3cad47db' 
  AND (
    token = 'pKWiPMMZK0LKeWpJlNV4eYFHNUCbxTgkxA+1H0sYt6U=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032