UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N+rKP0DY9UpRLKsmFGPMb4Vta7nXDX4puZLEZR0rnpA=' 
WHERE 
  key_id = '2ede03bed36d6c2e5098d88e2039d5b7249c6542a230778e7fdfde61f3cd40c6' 
  AND (
    token = 'N+rKP0DY9UpRLKsmFGPMb4Vta7nXDX4puZLEZR0rnpA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028