UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7zkWtgeI4UWjgX2EkWbPrvf9jAoDL9TurgdXcDmNSrs=' 
WHERE 
  key_id = 'c704a927de043ef15f5d4b47fb381786bf25970bb3b535d82e25eaa2a443f9b6' 
  AND (
    token = '7zkWtgeI4UWjgX2EkWbPrvf9jAoDL9TurgdXcDmNSrs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035